import React, { PureComponent } from 'react';
import { Carousel, Row, Col, List, Avatar, Card ,message} from 'antd';
import Header from '../../components/Header/Header.js'
import Footer from '../../components/Footer/Footer.js'
import axios from 'axios';
export default class UserInfo extends PureComponent {
    constructor(props) {
        super(props)
        this.state = {
            token: sessionStorage.getItem("token"),
        };
    }
    componentDidMount() {
        this.getUser();
        setTimeout(() => {
            this.setUser();
        }, 10000);
    }
    getUser = () => {
        axios({
            method: 'post',
            url: "http://localhost:8080/user/get",
            data: { token: this.state.token }
        }).then((res) => {
            try {
                const data = res.data.data;
            } catch (e) {
                console.log(e)
                message.error("回复内容获取失败")
            }
        });
    }
    setUser = () => {
        axios({
            method: 'post',
            url: "http://localhost:8080/user/insert",
            data: { rpid: 1, rcontents: '前端添加回复', runame: '前端',token:this.state.token }
        }).then((res) => {
            try {
                const data = res.data.data;
            } catch (e) {
                console.log(e)
                message.error("回复失败")
            }
        });
    }
    render() {

        const data = [
            {
                title: 'Ant Design Title 1',
            },
            {
                title: 'Ant Design Title 2',
            },
            {
                title: 'Ant Design Title 3',
            },
            {
                title: 'Ant Design Title 4',
            },
        ];
        return (<div>
            <Header current="userinfo" />
            <div className='action'>
                <Row>
                    <Col span="6">
                        <Carousel autoplay>
                            <div><img alt="example" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1525796488903&di=1c2a2401683a46ac0f404dfc4bd2d0f3&imgtype=0&src=http%3A%2F%2Fimg.baizhan.net%2Fuploads%2Fallimg%2F170421%2F46_170421105224_1.jpg" /></div>
                            <div><img alt="example" src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3089035910,837232727&fm=27&gp=0.jpg" /></div>
                            <div><img alt="example" src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=599097939,2122370908&fm=27&gp=0.jpg" /></div>
                            <div><img alt="example" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1526391546&di=3353e261b2bcd1b3827575bfab617742&imgtype=jpg&er=1&src=http%3A%2F%2Fimg.dugoogle.com%2Fwp-content%2Fuploads%2F2017%2F08%2FEEEEEEE.jpg" /></div>
                        </Carousel>
                    </Col>
                    <Col span="18" >
                        <List
                            style={{ border: 'solid 1px #ccc', boxSizing: 'border-box', marginLeft: '16px' }}
                            itemLayout="horizontal"
                            dataSource={data}
                            renderItem={item => (
                                <List.Item>
                                    <List.Item.Meta
                                        avatar={<Avatar src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />}
                                        title={<a href="https://ant.design">{item.title}</a>}
                                        description="Ant Design, a design language for background applications, is refined by Ant UED Team"
                                    />
                                </List.Item>
                            )}
                        />
                    </Col>
                </Row>
            </div>
            <Footer />
        </div>);
    }
}